package com.zjd.association.controller;

import com.zjd.association.common.R;
import com.zjd.association.common.Result;
import com.zjd.association.entity.Schedule;
import com.zjd.association.entity.Users;
import com.zjd.association.service.ScheduleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 日程管理 Controller
 *
 * @author: fql
 * @date: 2024-5-23
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/schedules")
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    //查询所有日程
    @GetMapping
    public R queryAllScheduleInfo(@RequestBody Users user){
        log.info("获取当前用户所有日程信息,{}", user);
        //调用Service层方法返回日程信息列表
        List<Schedule> scheduleList = scheduleService.queryAllScheduleInfo(user);
        return R.ok(scheduleList);
    }

    //查询所有日程2
    @GetMapping("/{id}")
    public Result queryAllScheduleInfo2(@PathVariable Integer id){
        log.info("获取当前用户所有日程信息id:{}", id);
        //调用Service层方法返回日程信息列表
        List<Schedule> scheduleList = scheduleService.queryAllScheduleInfo2(id);
        return Result.success(scheduleList);
    }

    //添加日程

    //删除日程

    //定义日程提醒

}
